import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小梅就是酱子
 * Date: 2022-01-26
 * Time: 18:45
 */
//比如输入1729，返回1+7+2+9
public class 输入一个非负整数返回组成它的数字之和 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        System.out.println(sum(num));
    }
    public static int sum(int num){
        if (num < 10) {
            return num;
        } else {
            return num%10+sum(num / 10);
        }
    }
}
